Hidden consumables polling functions #1193
Open
+102
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
SMODS.poll_soul(args), function to poll hidden consumables that returns the key, can return nil if none is selected. It takes the following arguments:set: stringset to check if the hidden consumable should replace.key?: stringrandom seed keymod?: numbermultiplies the hidden consumable ratesguaranteed?: booleanalways returns a key (if there's a valid consumable)allow_duplicates?: booleanact as if Showman is presentignore_vanilla?: booleanignores Soul and Black HoleAlso
SMODS.get_soul_rate(consumable, set)that gets the rate of a given consumable (0 if none, nil if invalid). Which also usesG.GAME.soul_modto modify the rate globally.Consumables now additionally take a table of sets for
soul_setand a function forsoul_rate.As a bonus, now modded hidden consumables can appear even if The Soul is banned (and respect their own bans).
There's some weird jank around Soul and Black Hole that I decided not to touch much to not mess with vanilla functionality so they don't follow the same logic as the rest (hence
ignore_vanilla). I'm also bad at math at 1 AM so I might have messed with some of the rate calculations in a way I don't realize.Additional Info: